{php include wl_template('common/header');}
<style type='text/css'>
.trbody td{text-align: center;vertical-align:top;border-left:1px solid #ccc;border-bottom: 1px solid #ddd;}
.order-rank img{width:16px;height:16px;}
.js-remark,.js-admin-remark{word-break:break-all;overflow:hidden;background: #FDEEEE;color: #ED5050;padding: 5px 10px;}
td.goods-info{position:relative;padding-left:60px;}
.goods-info .img{position:absolute;top:50%;margin-top:-25px;background: url({IMAGE_LOADING}
) center center no-repeat;width:50px;height:50px;}
.goods-info span{white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: block;}
.status-text{cursor:pointer;}
.col-md-1{padding-right: 0px;}
.all-tips{margin-left: 65px;}
span.effect-time{font-size: 12px;display: block;font-weight: 500;}
.row.row-fix, .form-group.form-group-fix{margin-left: -15px;margin-right: -15px;width: 500px;}
button.btn.btn-default.daterange.daterange-date{float: left;position: absolute;z-index: 100;}
#sel_child{z-index: 10;width: 200px;position: absolute;display: none;}
.show1{display: block;}
.hide1{display: none;}
.sty{display: block;width: 100%;font-size: 13px;height: 46px;overflow: hidden;white-space: nowrap;line-height: 46px;text-overflow: ellipsis;text-align: center;}
.spe{display: inline-block;text-align: center;display: block;height: 33px;margin-left: -12px;padding-top: 0px;line-height: 33px;}
.table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td{white-space: normal;}
span.ppp{text-align: center;display: inline-block;font-size: 14px;width: 100%;overflow: hidden;text-overflow: ellipsis;color: #e43;}
select#sel_parent{z-index: 1000;}
.nickname{margin-left: 94px;height: 34px;width: 200px;display: block;}
.col-xs-12.col-sm-6.col-sm-9.col-lg-6{z-index: 9999;}
.start-time{font-size: 12px;}
.end-time{font-size: 12px;}
</style>
<ul class="nav nav-tabs" id="myTab">
	<li class="active" ><a href="javascript:;">使用记录</a></li>
</ul>
<div class="app-content">
	<div class="app-filter">
		<div class="filter-list">
			<form action="" method="get" class="form-horizontal" role="form" id="form1">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="weliam_smartcity" />
				<input type="hidden" name="p" value="halfcard" />
				<input type="hidden" name="ac" {if $ac} value="{$ac}" {else} value="halfcard_web" {/if} />
				<input type="hidden" name="do" {if $ac} value="uselists" {else} value="userhalfcardlist" {/if} />
				<input type="hidden" name="type" value="{$type}" />
				<div class="form-group max-with-all">
					<label class="col-sm-2 control-label">类型</label>
					<div class="col-sm-9">
						<div class="btn-group">
							<a href="{php echo wl_filter_url('type:1');}" class="btn {if $type == 1}btn-primary{else}btn-default{/if}">特权</a>
							<a href="{php echo wl_filter_url('type:2');}" class="btn {if $type == 2}btn-primary{else}btn-default{/if}">礼包</a>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">关键字</label>
					<div class="col-md-3">
						<select name="keywordtype" class="form-control">
							<option value="">关键字类型</option>
							<option value="1" {if $_GPC['keywordtype']==1}selected="selected"{/if}>活动信息</option>
							{if !is_store()}
							<option value="2" {if $_GPC['keywordtype']==2}selected="selected"{/if}>商户信息</option>
							{/if}
							<option value="3" {if $_GPC['keywordtype']==3}selected="selected"{/if}>用户姓名</option>
							<option value="4" {if $_GPC['keywordtype']==4}selected="selected"{/if}>用户电话</option>
							<option value="5" {if $_GPC['keywordtype']==5}selected="selected"{/if}>核销员姓名</option>
						</select>
                    </div>
                    <div class="col-md-4">
                        <input type="text" name="keyword" class="form-control" value="{$_GPC['keyword']}"  placeholder="请输入关键字"/>
                    </div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">使用时间</label>
					<div class="col-md-3">
						{php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));}
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label"></label>
					<div class="col-sm-9">
						<input type="hidden" id="export" value="0" name="export" />
						<button class="btn btn-default" id="search"><i class="fa fa-search"></i> 搜索</button>
						<button class="btn btn-default btn-w-m" id="search2"><i class="fa fa-download"></i> 导出记录</button>
					</div>
				</div>	
			</form>
		</div>
	</div>
	<script type="text/javascript">
		$("#search").click(function(){
			$('#form1')[0].submit();
		});
		$("#search2").click(function(){
			$('#export').val(1);
			$('#form1')[0].submit();
		});
	</script>
	<div class="app-table-list">
		<div class="panel-body table-responsive collapse in" id="order-template-item-4" style="padding: 0;">
			<table class="table table-bordered table-hover">
				<thead style="background-color: #FFFFFF;">
				<tr>
					<th style="width:30px;" class="text-center"><input type="checkbox" onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});" /></th>
					<th style="width:150px;text-align:center;">活动信息</th>
					<th style="width:120px ;text-align: center;">商户信息</th>
					<th style="width:150px;text-align: center;">用户信息</th>
					{if $type != 2}
					<th style="width:80px; text-align:center;">订单金额</th>
					<th style="width:80px; text-align: center;">支付金额</th>
					{else}
					<th style="width:100px; text-align:center;">领取时间</th>
					{/if}
					<th style="width:80px; text-align:center;">核销员</th>
					<th style="width:100px; text-align:center;">使用时间</th>
				</tr>
				</thead>
				<tbody >
				{loop $halfcard $y $item}
				<tr>
					<td class="text-center" style="width:40px; height: auto;">
						<center><input type="checkbox" name="checkbox[]" class="checkbox" value="{$item['id']}" /></center>
					</td>
					<!--一卡通内容-->
					<td class="goods-info line-feed" style="width:180px;padding-left: 10px;">
						<div class="img"><img src="{IMAGE_PIXEL}" class="scrollLoading" data-url="{php echo tomedia($item['logo'])}" height="50" width="50" ></div>
						<div class="all-tips">
							<p class="" style="margin: 0;overflow : hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp:2;-webkit-box-orient: vertical;">{$item['title']}</p>
						</div>
					</td>
					<!--商户信息-->
					<td class="text-center" style="width:150px;height:60px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif ;">
					<p style="margin: 0;">{$item['storename']}</p>
					</td>
					<!--用户信息-->
					<td class="goods-info line-feed" style="width:150px; padding-left: 10px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif ;">
					<div class="img"><img src="{IMAGE_PIXEL}" class="scrollLoading" data-url="{php echo tomedia($item['avatar'])}" height="50" width="50" ></div>
					<div class="all-tips">
						<span class="" style="font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif ;">{$item['username']}</span>
						<span class="" style="font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif ;">{$item['mobile']}</span>
					</div>
					</td>
					{if $type != 2}
					<td class="text-center" style="width:80px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
					￥{$item['ordermoney']}
					</td>
					<td class="text-center" style="width:80px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
					<p style="margin-bottom: 5px;">￥{$item['realmoney']}</p>{if $item['freeflag']} <span class="label label-success">特权日</span>{/if}
					</td>
					{else}
					<td class="text-center" style="width:100px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
					{php echo date('Y-m-d H:i:s',$item['createtime'])}
					</td>
					{/if}
					<td class="text-center" style="width:100px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
					{$item['vername']}
					</td>
					<td class="text-center" style="width:100px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
					{if $item['usetime']}
					{php echo date('Y-m-d H:i:s',$item['usetime'])}
					{else}
					<span class="label label-warning">未使用</span>
					{/if}
					</td>
				</tr>
				{/loop}
				</tbody>
			</table>
		</div>
		<div id="de1" class="app-table-foot clearfix">
			<div class="pull-left">
				<a href="javascript:;" class="btn btn-default min-width js-batch js-delete">删除选中记录</a>
			</div>
			<div class="pull-right">
				{$pager}
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	require(['jquery', 'util'], function($, util){
		$('.js-copy').each(function(){
			var id=$(this).attr('data-id');
			util.clip($("#js-copy"+id), $(this).attr('data-url'));
		});
	});
</script>
<script type="text/javascript">
	$('#output').click(function(){
		var orderType = '{$_GPC['orderType']}';
		var status = '{$_GPC['status']}';
		var paytype = '{$_GPC['pay_type']}';
		var keywordtype = '{$_GPC['keywordtype']}';
		var keyword = '{$_GPC['keyword']}';
		var timetype = '{$_GPC['timetype']}';
		var times = "{$_GPC['time']['start']}";
		var timee = "{$_GPC['time']['end']}";
		location.href = "{php echo web_url('halfcard/order/output')}&orderType="+orderType+"&status="+status+"&paytype="+paytype+"&keywordtype="+keywordtype+"&keyword="+keyword+"&timetype="+timetype+"&times="+times+"&timee="+timee;
	});
	{if $ac}
	$(function(){
		//删除用户记录
		$('#de1').delegate('.js-delete','click',function(e){
			e.stopPropagation();
			var order_ids = [];
			var $checks=$('.checkbox:checkbox:checked');
			$checks.each(function() {
				if (this.checked) {
					order_ids.push(this.value);
				};
			});
				var $this = $(this);
				var ids = order_ids;
				//alert(ids);
				util.nailConfirm(this, function(state) {
				if(!state) return;
					$.post("{php echo web_url('halfcard/halftype/deleteHalfcardRecord')}", { ids : ids }, function(data){
						if(!data.errno){
						util.tips("删除成功！");
						location.reload();
						};
					}, 'json');
				}, {html: '确认删除?'});
			});
		});
	{else}
	$(function(){
		//删除用户记录
		$('#de1').delegate('.js-delete','click',function(e){
			e.stopPropagation();
			var order_ids = [];
			var $checks=$('.checkbox:checkbox:checked');
			$checks.each(function() {
				if (this.checked) {
					order_ids.push(this.value);
				};
			});
				var $this = $(this);
				var ids = order_ids;
				//alert(ids);
				util.nailConfirm(this, function(state) {
				if(!state) return;
					$.post("{php echo web_url('halfcard/halfcard_web/deleteHalfcardRecord')}", { ids : ids }, function(data){
						if(!data.errno){
						util.tips("删除成功！");
						location.reload();
						};
					}, 'json');
				}, {html: '确认删除?'});
			});
		});
	{/if}
	
		
//转换日期
	var dt=$('.date1').text().replace(/^\s+|\s+$/g, "");
	var yy=dt.slice(0,4);
	var mm=dt.slice(4,6);
	var dd=dt.slice(6,8);
	var str=(yy+'-'+mm+'-'+dd).toString();
	$('.date1').text(str);

//二级联动切换
$('#sel_parent').click(function(){
	if(this.value!=0){
		$('#sel_child').hide();
		$(".nickname").removeAttr("style");
		$('.nickname').show();
	}else{
		$('.nickname').hide();
		$('#sel_child').hide();	
		$('#sel_child').attr("display","block");
	}
})




</script>
{php include wl_template('common/footer');}